<%--
  Created by IntelliJ IDEA.
  User: Josh
  Date: 7/26/12
  Time: 9:09 PM
  A page to display campaign and character information.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<html>
<head>
    <title>Squire: Character Select</title>
    <link rel="STYLESHEET" type="text/css" href="css/squire.css" />
</head>
<body>
<jsp:include page="includes/header.html"></jsp:include>
<div class="wrapper">
    <%--The userid and ruleset parameters must be present to complete this query--%>
    <c:choose>
        <c:when test="${empty sessionScope.userid || empty sessionScope.ruleset}">
            <div class="error">An error occured: The userid or ruleset could not be resolved.<br />
            ${sessionScope.userid}<br />
            ${ruleset}</div>
        </c:when>
        <c:when test="${empty sessionScope.characters}">
            <p>You are not currently participating in any campaigns under this ruleset.</p>
        </c:when>
        <c:otherwise>
            <table class="select">
                <th>Campaigns</th>
                <c:forEach var="campaign" items="${campaigns}">
                    <tr class="campaign">
                        <td>${campaign}
                        <ul class="dropdown">
                            <c:forEach var="character" items="${characters.get(campaign)}">
                                <li><a href="/loadExodus?campaign=${campaign}&character=${character}">${character}</a></li>
                            </c:forEach>
                        </ul>
                        </td>
                    </tr>
                </c:forEach>
            </table>
        </c:otherwise>
    </c:choose>
</div>
</body>
</html>